/**
 * @Author YuanYuan
 * @Date 2022/9/9
 * @Time 17:33
 */
public class TestDemo {
    private static boolean isQuit = false;
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()-> {
            while (!isQuit) {
                System.out.println("isQuit为假");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

        });

        thread.start();

        Thread.sleep(1000);
        System.out.println("中断线程");
        isQuit = true;
        System.out.println("isQuit 为真");



    }
}
